package com.atguigu.gmall.item.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.SkuDetailService;
import com.atguigu.gmall.model.item.to.SkuDetailTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:lyd
 **/
@RestController
@RequestMapping("/api/inner/item")
public class SkuDetailRpcController {

    @Autowired
    SkuDetailService skuDetailService;

    @GetMapping("/detail/{skuId}")
    Result<SkuDetailTO> getSkuDetail(@PathVariable("skuId") Long skuId) {
        SkuDetailTO skuDetail = skuDetailService.getSkuDetail(skuId);
        return Result.ok(skuDetail);
    }
}
